from django.db import models
from django.contrib import auth
# Create your models here.k


class Diss(models.Model):
    diss_content = models.TextField(verbose_name="吐槽内容")
    create_time = models.DateTimeField(verbose_name="吐槽发布时间")
    diss_like = models.IntegerField(verbose_name="点赞个数")
    share_count = models.IntegerField(verbose_name="分享个数")
    collect_count = models.IntegerField(verbose_name="收藏数")
    # reply = models.CharField(max_length=128,default="", verbose_name="页面进行回复")
    publish = models.ForeignKey("users.User", verbose_name="发布文章人")
    # diss_id = models.IntegerField(verbose_name="吐槽文章id")
    # comment_count =

    def __str__(self):
        return self.diss_content

    class Meta:
        db_table = "Diss"
        verbose_name = "吐槽信息"
        verbose_name_plural = verbose_name


class Comment(models.Model):
    comment_people = models.ForeignKey("users.User", verbose_name="评论人")
    diss_comment = models.ForeignKey("Diss", verbose_name="吐槽评论", max_length=128)
    # diss_reply = models.CharField(max_length=100, verbose_name='评论内容')

    # diss_comment_like = models.IntegerField(verbose_name="评论点赞数")
    #
    # def __str__(self):
    #     return self.diss_comment

    class Meta:
        db_table = "Comment"
        verbose_name = "吐槽评论详情"
        verbose_name_plural = verbose_name


class Like(models.Model):
    # diss_id = models.ForeignKey("Diss", "吐槽文章id")
    diss_like_count = models.ForeignKey("Diss", verbose_name="文章点赞数")
    diss_comment_like_count = models.ForeignKey("Comment", verbose_name="吐槽评论点赞数")

    class Meta:
        db_table = "Like"
        verbose_name = "吐槽文章评论点赞"
        verbose_name_plural = verbose_name